<?php

	require_once $_SERVER['DOCUMENT_ROOT'] . "/chimera/dao/ConteudoDAO.class.php";
	
	//set_error_handler("customError");
	
	$action = $_GET['action'];
		
	if($action == 1445){
		remove::removeConteudo();
	}else if($action == 1446){
		remove::removeTags();
	}

	class remove{
		
		public function removeConteudo(){
			
			$idconteudo = $_GET['append'];
			$idcategoria = $_GET['appendcat'];
			$categoria = $_GET['match'];
			
			session_start();
			
			if($_SESSION['login'] == "danillo.souza"){
				$conteudodao = new ConteudoDAO();
				$conteudodao->remove($idconteudo);
			}
			
			header("Location: ../posts.php?append=".$idcategoria."&match=".$categoria."");
			
		}
		
		public function removeTags(){
			
			$idconteudo = $_GET['append'];
			$categoria = $_GET['match'];
			$tags = $_POST['tags'];
			
			$conteudodao = new ConteudoDAO();
			$conteudodao->removeTags($idconteudo, $tags);
			
			header("Location: ../post.php?append=".$idconteudo."&match=".$categoria."");	
				
		}
		
	}

?>